// Copyright 2007 the original author or authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package lichen.services;

import lichen.entities.user.User;


/**
 * 用户登录时候处理的服务类.
 * @author jcai
 * @version $Revision: 179 $
 * @since 0.0.1
 */

public interface UserService {
	


	/**
	 * 保存用户
	 * @param user 用户
	 * @since 0.0.3
	 */
	public void registerUser(User user,String plainPassword);
	
	/**
	 * 通过给定的用户和密码登录系统.
	 * @param userEmail 用户.
	 * @param password 密码.
	 * @throws InvalidateUserException 登录失败.
	 */
	public void loginUser(String userEmail,String password) throws InvalidateUserException;
	
	/**
	 * 激活在线用户.
	 * @param activeContent 在线用户的活动内容.
	 */
	public void activeOnlineUser(String activeContent);
	
	/**
	 * 是否为合法系统用户.
	 * true:合法 false:部可发
	 * 该方法是通过Cookies实现的
	 * @return boolean
	 */
	public boolean isSystemUser();
	
	/**
	 *  获取当前在线人数
	 *  @return 在线人数
	 */
	public long getOnlineUserNum();

	/**
	 * 是否存在email地址.
	 * @param email email地址.
	 * @return 是否存在.是为存在，反之亦反.
	 * @since 0.0.2
	 */
	public boolean isExistEmail(String email);

	/**
	 * 得到当前用户.
	 * @return 当前用户.
	 * @since 0.0.3
	 */
	public User getCurrentUser();



}
